package org.zxp.datastructure.map;

import org.junit.Test;

import java.util.Random;
import java.util.concurrent.ConcurrentSkipListMap;

/**
 * @program: effectiveJava
 * @description: ConcurrentSkipListMap测试
 * @author: X-Pacific zhang
 * @create: 2019-07-26 11:30
 **/
public class ConcurrentSkipListMapTest {
    public static void main(String[] args){
        ConcurrentSkipListMap map = new ConcurrentSkipListMap();
        map.put(1, "qwewqe");
        map.put(2, "qwewqe");
        map.put(7, "qwewqe");
        map.put(3, "qwewqe");
        map.put(9, "qwewqe");
        map.put(5, "qwewqe");
        map.put(4, "qwewqe");
        map.forEach((k,v) -> System.out.println(k));
    }


    @Test
    public void testMname(){
        for (int i = 0; i < 10; i++) {
            System.out.println(randomLevel());
        }
    }
    Random r = new Random();
    private int randomLevel() {
        int level = 1;
        for (int i = 1; i < 16; ++i) {
            if (r.nextInt() % 2 == 1) {
                level++;
            }
        }

        return level;
    }

}
